// 1. 引入二次封装过的axios
import request from '@/utils/request'
import type { TrademarkListDataModel, TrademarkModel } from './interface/trademarkModel'

enum Api {
  // 获取品牌数据
  getTrademarkListApi = '/admin/product/baseTrademark',
  // 添加品牌
  saveTrademarkApi = '/admin/product/baseTrademark/save',
  // 删除品牌
  deleteTrademarkApi = '/admin/product/baseTrademark/remove',
  // 更新品牌
  updateTrademarkApi = '/admin/product/baseTrademark/update'
}

// 获取品牌列表数据
export const reqGetTrademarkList = (page: number, limit: number) => {
  return request.get<any, TrademarkListDataModel>(`${Api.getTrademarkListApi}/${page}/${limit}`)
}

// 添加品牌数据
export function reqSaveTrademarkInfo(trademarkInfo: TrademarkModel) {
  return request.post<any, null>(Api.saveTrademarkApi, trademarkInfo)
}

// 删除品牌数据
export function reqDeleteTrademarkInfo(id: number) {
  return request.delete<any, null>(Api.deleteTrademarkApi + `/${id}`)
}

// 更改品牌数据
export const reqUpdateTrademarkInfo = (trademarkInfo: TrademarkModel) => {
  return request.put<any, null>(Api.updateTrademarkApi, trademarkInfo)
}